Language Summary

This section is a short summary of the language. It describes the lexical structure and how a sequence of ASCII characters is translated to a sequence of tokens and full stops. Note that this summary is not yet completed.

Translation unit

The program is specified in a translation unit that the compiler parsers and translates into ANSI C source, that is further translated into machine instruction.

program:
  translation-unit<sub>opt</sub>

Program entry point

When the program is evaluated by the operating system, the program entry point is a function main(), defined as

int main(int argc, char const *argv[])
{
  statements...
}

or

int main() { statements... }

In the first variant the operating system passes command line options that was given before evaluation started.

Line terminators

Line terminators need to be recognized so that Cyclone compiler can report line numbers and determine the end of comments, quoted literals and line continuation coherently. Lines are separated by ASCII LF (linefeed or newline) or CR (carriage return).

line-terminator:
  the LF or CR character or CRLF (also known as DOS line-ending)

input-character:
  any character but not LF or CR

A line terminator that is preceeded by \ (backslash) is continuation line.

Whitespaces

Whitespace is any character with ASCII codes less than or equal to that of ASCII space, i.e. control characters or space. Line terminators are control characters but have been identified in preceding clausul and are therefore included explicitly below.

whitespace:
  line-terminator
  control-character
  the ASCII SP character (aka space)

control-character:
  any ASCII control character (\000 to \037)

Comments

Comments can be either line or block comment. Line comment begins with // and extends up to and including the next line terminator. Block comments begins with /* and ends with */. Block comments cannot be nested.

[Example:

// line comment

/*
** Block comment
*/

end example]

Separators

The following 14 tokens are separators in Cyclone:

Separator: one of

(   )   {   }   [   ]   .   :
|   ||  ;   ,   ->  #

Keywords

The following 99 tokens are the keywords or reserved words in Cyclone:

Keyword: one of

ALIASABLE       NULL            REFCNT          RESTRICTED      UNIQUE

aqual_t         aquals          assert          asm             abstract
auto            break           calloc          case            catch
char            const           continue       cyclone_override datatype
default         do              double          else            enum
export          cyclone_hide    extern          fallthru        float
for             goto            if              inline          int
let             long            malloc          namespace       new
numelts         offsetof        qcalloc         qmalloc         qnew
rcalloc         region_t        region          regions         register
restrict        return          rmalloc         rmalloc_inline  rvmalloc
rnew            short           signed          sizeof          static
struct          switch          tagcheck        tagof           tag_t
throw           try             typedef         typeof          union
unsigned        using           valueof         valueof_t       void
volatile        while   

__attribute__           __attribute             __asm__                 __asm               
__builtin_va_list       _Complex                __complex__             __const__
__extension__           __inline__              __inline                __noinference__
__cyclone_port_on__     __cyclone_port_off__    __cyclone_pragma__      __restrict
__signed__              __tempest_on__          __tempest_off__         __typeof__
__unsigned__            __volatile__

Operators

The following 33 tokens are operators of Cyclone:

Operator: one of

+   -   *   /   %   <   >

Unary operator: one of

~   !   -   +

Assignment operator: one of

==  !=  <=  >=  ++  --  +=  -=
*=  /=  %=  |=  ^=  &=  <<= >>=
&&  ||  <<  >>  <>  ->  ... ::
:=: